/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;

/**
 *
 * @author kevin
 */
public class CpePanel extends JFrame {

    /** The panel for opening file and preprocess instances */
    protected OpenFilePanel m_OpenFilePanel = new OpenFilePanel();
    /** The tabbed pane that controls which sub-pane we are working with */
    protected JTabbedPane m_TabbedPane = new JTabbedPane();
    /** The panel for classify */
    protected ClassifyPanel m_ClassifyPanel = new ClassifyPanel();

    protected ProcessPanel m_ProcessPanel = new ProcessPanel();

    protected MultiClassPanel m_MultiClassPanel = new MultiClassPanel();

    public CpePanel() {
        m_TabbedPane.addTab(
                m_OpenFilePanel.getTabTitle(),
                null,
                m_OpenFilePanel,
                m_OpenFilePanel.getTabTitleToolTip());
        m_TabbedPane.addTab(
                m_ClassifyPanel.getTabTitle(),
                null,
                m_ClassifyPanel,
                m_ClassifyPanel.getTabTitleToolTip());
        m_TabbedPane.addTab(
                m_ProcessPanel.getTabTitle(),
                null,
                m_ProcessPanel,
                m_ProcessPanel.getTabTitleToolTip()
                );
        m_TabbedPane.addTab(
                this.m_MultiClassPanel.getTabTitle(),
                null,
                this.m_MultiClassPanel,
                this.m_MultiClassPanel.getTabTitleToolTip()
                );

        m_TabbedPane.setEnabledAt(1, false);
        // setup notification for dataset changes
        m_OpenFilePanel.addPropertyChangeListener(new PropertyChangeListener() {

            public void propertyChange(PropertyChangeEvent evt) {
                m_ClassifyPanel.setInstances(m_OpenFilePanel.getInstances());
                m_TabbedPane.setEnabledAt(1, true);
            }
        });
        add(m_TabbedPane);
    }
}
